/* eslint-disable no-unused-expressions */
const imgURL = (path, size) => {
  return '//img2.tgbus.com/i/' + size + path
}

const linkURL = (path, item, checkURL = true) => {
  if (!path) {
    return path
  }
  if (checkURL && item && item.redirectstatus && item.redirectstatus === 1) {
    /* eslint-disable no-useless-escape */
    path = path.replace(/([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}/, item.channelpath)
    /* eslint-enable no-useless-escape */
  }
  return path
}

module.exports = {
  imgURL,
  linkURL
}
